USE [BMIG_Mensual_POST_CADENA]
GO

IF EXISTS (SELECT name FROM   sysobjects  WHERE  name = N'[dbo].[WASP_M0014_CREATE_SEG_CESANTIA]'  AND 	type = 'P')
    DROP PROCEDURE [dbo].[WASP_M0014_CREATE_SEG_CESANTIA]
GO
CREATE PROCEDURE [dbo].[WASP_M0014_CREATE_SEG_CESANTIA]
AS

BEGIN
		if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[AS_seguro_cesantia]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
		drop table [dbo].[AS_seguro_cesantia]
END

BEGIN
		CREATE TABLE [dbo].[AS_seguro_cesantia] (
			[APELLIDO1]			[varchar] (30) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
			[APELLIDO2]			[varchar] (30) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
			[NOMBRE1]			[varchar] (25) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
			[NOMBRE2]			[varchar] (25) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
			[RUT]				[numeric] NOT NULL ,
			[DV]				[varchar] (1) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
			[DIRTRABAJA]		[varchar] (65) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
			[COMUNATRAB]		[VARCHAR] (30) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
			[FECNAC]			[varchar] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
			[FECHAOTCRE]		[varchar] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
			[MONCRE]			[numeric](18, 0) NULL ,
			[FOLIO]				[numeric] NOT NULL ,
			[VALCUO]			[numeric](18, 0) NULL ,
			[CUOTAS]			[numeric] NULL ,
			[FECHTER]			[varchar] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
			[VAL_SEG]			[numeric](18, 0) NULL ,
			[NUMERO_DE_CREDITO] [numeric] ,
			[FACREDITO]			[varchar] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
			[FVCUOTAS]			[NUMERIC] ,
			[AGENCOLOC]			[numeric] NULL 
		) ON [PRIMARY]
END